package jp.ne.hatena.d.digitalsoul.warikan.contexts.rootpopulaters

import jp.ne.hatena.d.digitalsoul.warikan.models._
import jp.ne.hatena.d.digitalsoul.warikan.repositories._

trait SlopePopulater {
	
	def populateSlope(role:Object):Slope = {
		val slope:Slope = role.asInstanceOf[Slope]
		populate(slope)
		slope
	}
	
	
	private def populate(slope:Slope) = {
		if(SlopeRepository.exists(slope.id))
			slope.populateWith(SlopeRepository.forSlopeId(slope.id))
	}

}